mailman: New mailman package (mailing list manager)
authorDenis Shulyaka <[email protected]>
Sat, 25 Oct 2014 22:51:01 +0000 (01:51 +0300)
committerDenis Shulyaka <[email protected]>
Sun, 26 Oct 2014 09:39:44 +0000 (12:39 +0300)
Signed-off-by: Denis Shulyaka <[email protected]>
mail/mailman/Makefile [new file with mode: 0644]
mail/mailman/files/mailman.init [new file with mode: 0644]
mail/mailman/patches/100-postfix.patch [new file with mode: 0644]
mail/mailman/patches/200-nohostdnspython.patch [new file with mode: 0644]

diff --git a/mail/mailman/Makefile b/mail/mailman/Makefile
new file mode 100644 (file)
index 0000000..c797501
--- /dev/null
@@ -0,0 +1,124 @@
+# 
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=mailman
+PKG_RELEASE:=1
+PKG_SOURCE_URL:=ftp://ftp.gnu.org/gnu/mailman/
+PKG_VERSION:=2.1.18-1
+PKG_MD5SUM:=dc861ed9698a98499a951eaef7d4db9f
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_MAINTAINER:=Denis Shulyaka <[email protected]>
+PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE_FILE:=gnu-COPYING-GPL
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mailman
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=The GNU Mailing List Manager
+  URL:=http://www.gnu.org/software/mailman/
+  DEPENDS:=+postfix +python-mini +uhttpd +python-dns #+python-dev
+endef
+
+define Package/mailman/description
+ Mailman is free software for managing electronic mail discussion and e-newsletter lists.
+endef
+
+prefix=/usr/local/mailman
+
+define Package/mailman/conffiles
+$(prefix)/Mailman/mm_cfg.py
+endef
+
+CONFIGURE_ARGS += \
+       --prefix="$(prefix)" \
+       --exec-prefix="$(prefix)" \
+       --with-python="/usr/bin/python" \
+       --with-username="root" \
+       --with-groupname="root" \
+       --with-mail-gid="nogroup" \
+       --with-cgi-gid="root" \
+       --without-permcheck \
+
+define Package/mailman/install
+       $(INSTALL_DIR) $(1)$(prefix)
+       cd $(PKG_BUILD_DIR); $(MAKE) DESTDIR=$(1) install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mailman.init $(1)/etc/init.d/mailman
+       $(INSTALL_DIR) $(1)/usr/www
+       ln -s $(prefix)/cgi-bin/ $(1)/usr/www/mailman
+       ln -s $(prefix)/archives/public/ $(1)/usr/www/pipermail
+       ln -s $(prefix)/icons $(1)/usr/www/icons
+endef
+
+define Package/mailman/postinst
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+
+ if [ `postconf alias_maps | grep -ci mailman` -eq 0 ]
+ then
+  postconf -e "`postconf alias_maps`, cdb:$(prefix)/data/aliases"
+ fi
+ cd $(prefix)
+ hostname=`cat /proc/sys/kernel/hostname`
+ if [ ! -f data/aliases ]
+ then
+  ./bin/genaliases
+ fi
+ newaliases
+ if [ `grep -c DEFAULT_URL_HOST Mailman/mm_cfg.py` -eq 0 ]
+ then
+  echo "DEFAULT_EMAIL_HOST = '$$hostname'" >> Mailman/mm_cfg.py
+  echo "DEFAULT_URL_HOST = '$$hostname'" >> Mailman/mm_cfg.py
+  echo "add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)" >> Mailman/mm_cfg.py
+  echo "QRUNNERS.remove(('NewsRunner',1))" >> Mailman/mm_cfg.py
+ fi
+ if [ `./bin/list_lists | grep -ci mailman` -eq 0 ]
+ then
+  ./bin/newlist --urlhost=$$hostname --emailhost=$$hostname --quiet mailman root@$$hostname mailman
+  ./bin/config_list -i data/sitelist.cfg mailman
+  echo "NOTE: A default site-wide mailing list Mailman with password 'mailman' has been created. Please review it and change the password."
+  ./bin/mmsitepass mailman
+  echo "NOTE: The default site password 'mailman' has been created."
+ fi
+ if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ]
+ then
+  $(prefix)/bin/mailmanctl -q restart
+ fi
+ if [ `grep -c mailman /etc/config/uhttpd` -eq 0 ]
+ then #we assume that the server is not configured yet, thus print out some help for the first time:
+  echo "NOTE: Please set the site password using $(prefix)/bin/mmsitepass <your-site-password>"
+  echo "Please add uhttpd config section to your /etc/config/uhttpd like this:"
+  echo "config uhttpd mailman"
+  echo "       list listen_http        0.0.0.0:80"
+  echo "       option home             /usr/www"
+  echo "       option cgi_prefix       /mailman"
+  echo "       no_symlinks             0"
+  echo "Don't forget to setup firewall for accessing this website!"
+  echo "To add a mailing list go to http://$$hostname/mailman/create."
+ fi
+ # /etc/init.d/mailman enable
+fi
+endef
+
+define Package/mailman/prerm
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+
+ if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ]
+ then
+  $(prefix)/bin/mailmanctl stop
+ fi
+fi
+endef
+
+$(eval $(call BuildPackage,mailman))
diff --git a/mail/mailman/files/mailman.init b/mail/mailman/files/mailman.init
new file mode 100644 (file)
index 0000000..f68a456
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2014 OpenWrt.org
+
+START=50
+STOP=50
+
+PYTHON=/usr/bin/python
+MAILMANHOME=/usr/local/mailman
+MAILMANCTL=$MAILMANHOME/bin/mailmanctl
+
+start() {
+       #rm -f $MAILMANHOME/locks/*
+       $PYTHON $MAILMANCTL -s -q start
+}
+
+stop() {
+       $PYTHON $MAILMANCTL -q stop
+}
+
+restart() {
+       $PYTHON $MAILMANCTL -q restart
+}
diff --git a/mail/mailman/patches/100-postfix.patch b/mail/mailman/patches/100-postfix.patch
new file mode 100644 (file)
index 0000000..857b99b
--- /dev/null
@@ -0,0 +1,12 @@
+diff -rupN mailman-2.1.14-1/Mailman/Defaults.py.in mailman-2.1.14-1_patched/Mailman/Defaults.py.in
+--- mailman-2.1.14-1/Mailman/Defaults.py.in    2011-03-01 23:35:57.000000000 +0300
++++ mailman-2.1.14-1_patched/Mailman/Defaults.py.in    2011-03-09 12:26:10.000000000 +0300
+@@ -439,7 +439,7 @@ DELIVERY_MODULE = 'SMTPDirect'
+ # standard out (or send an email to the site list owner) for manual twiddling
+ # of an /etc/aliases style file.  Use 'Postfix' if you are using the Postfix
+ # MTA -- but then also see POSTFIX_STYLE_VIRTUAL_DOMAINS.
+-MTA = 'Manual'
++MTA = 'Postfix'
+ # If you set MTA='Postfix', then you also want to set the following variable,
+ # depending on whether you're using virtual domains in Postfix, and which
diff --git a/mail/mailman/patches/200-nohostdnspython.patch b/mail/mailman/patches/200-nohostdnspython.patch
new file mode 100644 (file)
index 0000000..e321106
--- /dev/null
@@ -0,0 +1,68 @@
+diff -Naur mailman-2.1.18-1/configure mailman-2.1.18-1_patched/configure
+--- mailman-2.1.18-1/configure 2014-10-26 12:00:38.090360119 +0300
++++ mailman-2.1.18-1_patched/configure 2014-10-26 12:00:21.323016430 +0300
+@@ -2236,35 +2236,35 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version" >&5
+ $as_echo "$version" >&6; }
+-# See if dnspython is installed.
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dnspython" >&5
+-$as_echo_n "checking dnspython... " >&6; }
+-
+-cat > conftest.py <<EOF
+-try:
+-    import dns.resolver
+-    res = 'ok'
+-except ImportError:
+-    res = 'no'
+-fp = open("conftest.out", "w")
+-fp.write("%s\n" % res)
+-fp.close()
+-EOF
+-
+-$PYTHON conftest.py
+-havednspython=`cat conftest.out`
+-rm -f conftest.out conftest.py
+-if test "$havednspython" = "no"
+-then
+-    as_fn_error $? "
+-
+-***** dnspython not found. It is required for the new
+-***** dmarc_moderation_action featurer. Get it from
+-***** <http://www.dnspython.org/> or
+-***** <https://pypi.python.org/pypi/dnspython/>" "$LINENO" 5
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $havednspython" >&5
+-$as_echo "$havednspython" >&6; }
++## See if dnspython is installed.
++#{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dnspython" >&5
++#$as_echo_n "checking dnspython... " >&6; }
++#
++#cat > conftest.py <<EOF
++#try:
++#    import dns.resolver
++#    res = 'ok'
++#except ImportError:
++#    res = 'no'
++#fp = open("conftest.out", "w")
++#fp.write("%s\n" % res)
++#fp.close()
++#EOF
++#
++#$PYTHON conftest.py
++#havednspython=`cat conftest.out`
++#rm -f conftest.out conftest.py
++#if test "$havednspython" = "no"
++#then
++#    as_fn_error $? "
++#
++#***** dnspython not found. It is required for the new
++#***** dmarc_moderation_action featurer. Get it from
++#***** <http://www.dnspython.org/> or
++#***** <https://pypi.python.org/pypi/dnspython/>" "$LINENO" 5
++#fi
++#{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $havednspython" >&5
++#$as_echo "$havednspython" >&6; }
+ # Check the email package version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python's email package" >&5